package com.xiaotu.dao.sw;

import com.xiaotu.model.SwCommentModel;
import com.xiaotu.vo.SwCommentVo;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author zhangxiao
 * @create 2021-08-30 16:36
 */
public interface SwCommentMapper extends Mapper<SwCommentModel> {

    @Select("SELECT " +
            " t2.comment_id, " +
            " t2.comment_content, " +
            " t2.comment_time, " +
            " t3.nick_name, " +
            " t3.avatar_url  " +
            "FROM " +
            " tab_sw_comment t1 " +
            " INNER JOIN tab_sw_comment_info t2 ON t1.comment_id = t2.comment_id " +
            " INNER JOIN tab_wx_user t3 ON t1.comment_user_id = t3.userid  " +
            "WHERE " +
            " t1.be_comment_star_id = #{starId} " +
            " AND t1.auth_status = 1 " +
            "ORDER BY " +
            " t2.comment_time DESC ")
    List<SwCommentVo> comments(Integer starId);

}
